/* rqadesc.p Requisition Approver Descriptions                              */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/*F0PN*/ /*V8:ConvertMode=NoConvert                                         */
/* REVISION 8.5       LAST MODIFIED: 04/15/97  BY: *J1Q2* Patrick Rowan     */
/* REVISION 8.6       LAST MODIFIED: 05/15/98  BY: *J2GM* Patrick Rowan     */
/* REVISION 8.6       LAST MODIFIED: 06/18/98  BY: *K1PK* D. Belbeck        */
/* REVISION 9.1       LAST MODIFIED: 08/12/00  BY: *N0KP* myb               */


/*!
 ----------------------------------------------------------------------------
 DESCRIPTION: Internal procedure to retrieve names, descriptions, etc.
              Supports the multi-line Purchase Requisition Module of MFG/PRO.

 ============================================================================
 !*/
         {mfdeclre.i " "}

         /*  RETRIEVE NAMES/DESCRIPTIONS  */

         define input parameter in_apr      like rqa_apr no-undo.
         define input parameter in_entity   like rqa_entity no-undo.
         define input parameter in_category like rqa_category no-undo.
         define input parameter in_job      like rqa_job no-undo.
         define input parameter in_site     like rqa_site no-undo.
         define input parameter in_prod_line
                                            like rqa_prod_line no-undo.
         define input parameter in_sub_from
                                            like rqa_sub_from no-undo.
         define input parameter in_cc_from  like rqa_cc_from no-undo.
         define input parameter in_sub_to   like rqa_sub_to no-undo.
         define input parameter in_cc_to    like rqa_cc_to no-undo.
         define input parameter in_rvw_level
                                            like rqa_rvw_level no-undo.
         define input parameter in_apr_level
                                            like rqa_apr_level no-undo.
         define input parameter in_alt1_apr like rqa_alt_apr[1] no-undo.
         define input parameter in_alt2_apr like rqa_alt_apr[2] no-undo.
         define input parameter in_admin_apr
                                            like rqa_admin_apr no-undo.


         define output parameter out_apr_name       as character no-undo.
         define output parameter out_apr_email_addr as character no-undo.
         define output parameter out_entity_name    as character no-undo.
         define output parameter out_category_desc  as character no-undo.
         define output parameter out_job_desc       as character no-undo.
         define output parameter out_site_desc      as character no-undo.
         define output parameter out_prod_line_desc as character no-undo.
         define output parameter out_sub_from_desc  as character no-undo.
         define output parameter out_cc_from_desc   as character no-undo.
         define output parameter out_sub_to_desc    as character no-undo.
         define output parameter out_cc_to_desc     as character no-undo.
         define output parameter out_rvw_level_desc as character no-undo.
         define output parameter out_rvw_level_amt  like rql_amt no-undo.
         define output parameter out_apr_level_desc as character no-undo.
         define output parameter out_apr_level_amt  like rql_amt no-undo.
         define output parameter out_alt1_apr_name  as character no-undo.
         define output parameter out_alt2_apr_name  as character no-undo.
         define output parameter out_admin_apr_name as character no-undo.


         /* APPROVER */
         find usr_mstr
            where usr_userid = in_apr no-lock no-error.
         if available(usr_mstr) then do:
            out_apr_name = usr_name.
/*J2GM*     out_apr_email_addr = usr__qad01.    */
/*J2GM*/    out_apr_email_addr = usr_mail_address.
         end.
         else do:
            out_apr_name = "".
            out_apr_email_addr = "".
         end.  /* if available(usr_mstr) */

         /* ENTITY */
         find en_mstr
            where en_entity = in_entity no-lock no-error.
         if available(en_mstr) then
            out_entity_name = en_name.
         else
            out_entity_name = "".

         /* CATEGORY */
         find rqc_mstr
            where rqc_category = in_category no-lock no-error.
         if available(rqc_mstr) then
            out_category_desc = rqc_desc.
         else
            out_category_desc = "".

         /* JOB */
         find rqj_mstr
            where rqj_job = in_job no-lock no-error.
         if available(rqj_mstr) then
            out_job_desc = rqj_desc.
         else
            out_job_desc = "".

         /* SITE */
         find si_mstr
            where si_site = in_site no-lock no-error.
         if available(si_mstr) then
            out_site_desc = si_desc.
         else
            out_site_desc = "".

         /* PRODUCT LINE */
         find pl_mstr
            where pl_prod_line = in_prod_line no-lock no-error.
         if available(pl_mstr) then
            out_prod_line_desc = pl_desc.
         else
            out_prod_line_desc = "".

         /* SUBACCOUNT FROM */
         if in_sub_from = "" then
            out_sub_from_desc = "".
         else do:
            find sb_mstr
               where sb_sub = in_sub_from no-lock no-error.
            if available(sb_mstr) then
               out_sub_from_desc = sb_desc.
            else
               out_sub_from_desc = "".
         end.

         /* COST CENTER FROM */
         if in_cc_from = "" then
            out_cc_from_desc = "".
         else do:
            find cc_mstr
               where cc_ctr = in_cc_from no-lock no-error.
            if available(cc_mstr) then
               out_cc_from_desc = cc_desc.
            else
               out_cc_from_desc = "".
         end.


         /* SUBACCOUNT TO */
         if in_sub_to = "" then
            out_sub_to_desc = "".
         else do:
            find sb_mstr
               where sb_sub = in_sub_to no-lock no-error.
            if available(sb_mstr) then
               out_sub_to_desc = sb_desc.
            else
               out_sub_to_desc = "".
         end.

         /* COST CENTER TO */
         if in_cc_to = "" then
            out_cc_to_desc = "".
         else do:
            find cc_mstr
               where cc_ctr = in_cc_to no-lock no-error.
            if available(cc_mstr) then
               out_cc_to_desc = cc_desc.
            else
               out_cc_to_desc = "".
         end.

         /* REVIEW LEVEL & AMOUNT */
         find rql_mstr
            where rql_level = in_rvw_level no-lock no-error.
         if available(rql_mstr) then do:
            out_rvw_level_desc = rql_desc.
            out_rvw_level_amt = rql_amt.
         end.
         else do:
            out_rvw_level_desc = "".
            out_rvw_level_amt = 0.
         end.

         /* APPROVAL LEVEL & AMOUNT */
         find rql_mstr
            where rql_level = in_apr_level no-lock no-error.
         if available(rql_mstr) then do:
            out_apr_level_desc = rql_desc.
            out_apr_level_amt = rql_amt.
         end.
         else do:
            out_apr_level_desc = "".
            out_apr_level_amt = 0.
         end.

         /* ALTERNATE APPROVER #1 NAME */
         if in_alt1_apr = "" then
            out_alt1_apr_name = "".
         else do:
            find usr_mstr
               where usr_userid = in_alt1_apr no-lock no-error.
            if available(usr_mstr) then
               out_alt1_apr_name = usr_name.
            else
               out_alt1_apr_name = "".
         end.

         /* ALTERNATE APPROVER #2 NAME */
         if in_alt2_apr = "" then
            out_alt2_apr_name = "".
         else do:
            find usr_mstr
               where usr_userid = in_alt2_apr no-lock no-error.
            if available(usr_mstr) then
               out_alt2_apr_name = usr_name.
            else
               out_alt2_apr_name = "".
         end.

         /* ADMIN APPROVER NAME */
         if in_admin_apr = "" then
            out_admin_apr_name = "".
         else do:
            find usr_mstr
               where usr_userid = in_admin_apr no-lock no-error.
            if available(usr_mstr) then
               out_admin_apr_name = usr_name.
            else
               out_admin_apr_name = "".
         end.
